$(function(){
        // don't forget this init!      
               
        var childWin;
        $('#schedule-button').click(function(){
          childWin = window.open('/phoenix/controller/selectschedule','child', "width=500, height=500, location=no, menubar=no, scrollbars=no, status=no, toolbar=no");
          if (window.focus) {childWin.focus()}
        });
        
 
        // set up the message handlers, listen for events 'childMsg1' and 'childMsg2'     
        $.windowMsg("set-start-date", function(message) {
        	console.log($('#start_time'));
          $('#start_time').val(message);
        });
        $.windowMsg("set-end-date", function(message) {
        	console.log($('#end_time'));
            $('#end_time').val(message);
        });
        

        $(':button').click(function(){
        	var row =  $(this).attr('class');
        	console.log("selecting row " + row);            
       
            var start =  $('#' + row).attr("data-start");
            var end =  $('#' + row).attr("data-end");
            console.log("selected startdate " + start);
            console.log("selected enddate " + end);
	        $.triggerParentEvent("set-start-date", start);
	        $.triggerParentEvent("set-end-date", end); 
           
          });
        
      });  